package com.kupal.ahk.event;

import com.kupal.ahk.util.RobotProvider;

import java.awt.Robot;

/**
 * @author Krauchenia Sergey
 *         Date: 13.10.2010
 *         Time: 19:56:04
 */
public class Event {

    protected static Robot ROBOT = RobotProvider.get();

    /** default delay between keys pressing  */
    private static final int DEFAULT_DELAY = 100;

    static {
        configureRobot();
    }

    /**
     * Set auto delay, which will be used
     * for every pressing/releasing key
     * @param ms delay time in milliseconds
     */
    public static void setDelay(int ms) {
        ROBOT.setAutoDelay(ms);
    }

    /**
     * Return auto delay of robot to default value
     */
    public static void backToDefaultDelay() {
        ROBOT.setAutoDelay(DEFAULT_DELAY);
    }

    private static void configureRobot() {
        ROBOT.setAutoDelay(DEFAULT_DELAY);
    }
}
